package com.esa.db;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBBean {
	Pool          m_Pool = Pool.getInstance(); 
	public boolean doDelete(String sql){
		Connection conn=m_Pool.getConnection();	
		Statement statement = null;
		boolean result=false;
		try {
			statement=conn.createStatement();
			statement.execute(sql);
			
			result=true;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally {
			m_Pool.freeConnection(conn);
			try{
				statement.close();
			}catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return result;
	}
	
	public ResultSet doQuery(String sql){
		ResultSet rs=null;
		Connection conn=m_Pool.getConnection();	
		Statement statement = null;
		try {
			statement=conn.createStatement();
			rs=statement.executeQuery(sql);
		}catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		/*finally {
			m_Pool.freeConnection(conn);
			try{
				statement.close();
			}catch(SQLException e){
				e.printStackTrace();
			}*/
		
		return rs;
	}
}
